export function gettime() {
    let time = new Date()
    let day = time.getDay()
    let localDate = time.toLocaleDateString()
    if (day == 1) {
        day = "星期一";
    } else if (day == 2) {
        day = "星期二";

    } else if (day == 2) {
        day = "星期二";

    } else if (day == 3) {
        day = "星期三";

    } else if (day == 4) {
        day = "星期四";

    } else if (day == 5) {
        day = "星期五";

    } else if (day == 6) {
        day = "星期六";

    } else if (day == 0) {
        day = "星期天";
    }
    let list = [day, localDate]
    return list;
}

export function lasting() {
    let nowtime = new Date();
    let pasttime = new Date(2021, 6, 15, 12, 0, 0);
    let truetime = parseInt((nowtime - pasttime) / 1000);
    let Day = parseInt(truetime / 86400);
    let Hour = parseInt((truetime % 86400) / 3600);
    let minuter = parseInt(((truetime % 86400) % 3600) / 60);
    let second = truetime % 60;
    Day = Day < 10 ? "0" + Day : Day;
    Hour = Hour < 10 ? "0" + Hour : Hour;
    minuter = minuter < 10 ? "0" + minuter : minuter;
    second = second < 10 ? "0" + second : second;
    let timestr = Day + '天' + Hour + '时' + minuter + '分' + second + '秒';
    return timestr;
}

export function formatTime(time) {
    return new Date(parseInt(time) + 8 * 3600 * 1000).toJSON().substr(0, 19).replace('T', ' ')
}